home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / human interface toolbox / packagetool / utilities.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-23  |  17.3 KB  |  480 lines

  1. /*
  2.     File: Utilities.c
  3.     
  4.     Description:
  5.         This file contains the a number of utility routines used in the
  6.     PackagTool example.  they have been moved to this file
  7.     to simplify the example.
  8.     
  9.     PackageTool is an application illustrating how to create application
  10.     packages in Mac OS 9.  It provides a simple interface for converting
  11.     correctly formatted folders into packages and vice versa.
  12.  
  13.     Copyright:
  14.         © Copyright 1999 Apple Computer, Inc. All rights reserved.
  15.     
  16.     Disclaimer:
  17.         IMPORTANT:  This Apple software is supplied to you by Apple Computer, Inc.
  18.         ("Apple") in consideration of your agreement to the following terms, and your
  19.         use, installation, modification or redistribution of this Apple software
  20.         constitutes acceptance of these terms.  If you do not agree with these terms,
  21.         please do not use, install, modify or redistribute this Apple software.
  22.  
  23.         In consideration of your agreement to abide by the following terms, and subject
  24.         to these terms, Apple grants you a personal, non-exclusive license, under Apple’s
  25.         copyrights in this original Apple software (the "Apple Software"), to use,
  26.         reproduce, modify and redistribute the Apple Software, with or without
  27.         modifications, in source and/or binary forms; provided that if you redistribute
  28.         the Apple Software in its entirety and without modifications, you must retain
  29.         this notice and the following text and disclaimers in all such redistributions of
  30.         the Apple Software.  Neither the name, trademarks, service marks or logos of
  31.         Apple Computer, Inc. may be used to endorse or promote products derived from the
  32.         Apple Software without specific prior written permission from Apple.  Except as
  33.         expressly stated in this notice, no other rights or licenses, express or implied,
  34.         are granted by Apple herein, including but not limited to any patent rights that
  35.         may be infringed by your derivative works or by other works in which the Apple
  36.         Software may be incorporated.
  37.  
  38.         The Apple Software is provided by Apple on an "AS IS" basis.  APPLE MAKES NO
  39.         WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
  40.         WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  41.         PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
  42.         COMBINATION WITH YOUR PRODUCTS.
  43.  
  44.         IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
  45.         CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  46.         GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  47.         ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION
  48.         OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT
  49.         (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN
  50.         ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  51.  
  52.     Change History (most recent first):
  53.         Fri, Dec 17, 1999 -- created
  54. */
  55.  
  56.  
  57. #include "Utilities.h"
  58. #include <QuickDraw.h>
  59. #include <Gestalt.h>
  60. #include <Palettes.h>
  61. #include <Threads.h>
  62. #include <fp.h>
  63. #include <FinderRegistry.h>
  64. #include <Resources.h>
  65. #include <Processes.h>
  66.  
  67. /* ValidFSSpec verifies that *spec refers is formatted correctly, and it
  68.     verifies that it refers to an existing file in an existing directory on
  69.     and existing volume. If *spec is valid, the function returns noErr,
  70.     otherwise an error is returned. */
  71. OSErr ValidFSSpec(FSSpec *spec) {
  72.     FInfo fndrInfo;
  73.         /* check the name's size */
  74.     if (spec->name[0] + (sizeof(FSSpec) - sizeof(spec->name)) > sizeof(FSSpec)) return paramErr;
  75.         /* ckeck if it refers to a file */
  76.     return FSpGetFInfo(spec, &fndrInfo);
  77. }
  78.  
  79.  
  80. /* ResolveAliasQuietly resolves an alias using a fast search with no user interaction.  Our main loop
  81.     periodically resolves gFileAlias comparing the result to gTargetFile to keep the display up to date.
  82.     As a result, we would like the resolve alias call to be as quick as possible AND since the application
  83.     may be in the background when  it is called, we don't want any user interaction. */
  84. OSErr ResolveAliasQuietly(ConstFSSpecPtr fromFile, AliasHandle alias, FSSpec *target, Boolean *wasChanged) {
  85.     short aliasCount;
  86.     Boolean needsUpdate;
  87.     OSErr err;
  88.         /* set up locals */
  89.     aliasCount = 1;
  90.     needsUpdate = false;
  91.     *wasChanged = false;
  92.         /* call MatchAlias to resolve the alias.  
  93.             kARMNoUI = no user interaction,
  94.             kARMSearch = do a fast search. */
  95.     err = MatchAlias(NULL, (kARMNoUI | kARMSearch), alias, &aliasCount, target, &needsUpdate, NULL, NULL);
  96.     if (err == noErr) {
  97.             /* if the alias was changed, update it. */
  98.         err = UpdateAlias(fromFile, target, alias, wasChanged);
  99.     }
  100.     return err;
  101. }
  102.  
  103.  
  104.  
  105.  
  106. /* GrayOutBox grays out an area of the screen in the current grafport.  
  107.     *theBox is in local coordinates in the current grafport. This routine
  108.     is for direct screen drawing only.  */
  109. void GrayOutBox(Rect *theBox) {
  110.     long response;
  111.     Rect globalBox;
  112.     GDHandle maxDevice;
  113.     RGBColor rgbWhite = {0xFFFF, 0xFFFF, 0xFFFF}, rgbBlack = {0, 0, 0}, sForground, sBackground;
  114.     PenState penSave;
  115.         /* save the current drawing state */
  116.     GetPenState(&penSave);
  117.         /* if no color quickdraw, fail...*/
  118.     if (Gestalt(gestaltQuickdrawVersion, &response) != noErr) response = 0;
  119.     if (response >= gestalt8BitQD) {
  120.             /* get the device for the rectangle */
  121.         globalBox = *theBox;
  122.         LocalToGlobal((Point*) &globalBox.top);
  123.         LocalToGlobal((Point*) &globalBox.bottom);
  124.         maxDevice = GetMaxDevice(&globalBox);
  125.         if (maxDevice != NULL) {
  126.                 /* calculate the best gray */
  127.             if ( GetGray(maxDevice, &rgbWhite, &rgbBlack)) {
  128.                     /* draw over the area in gray using addMax transfer mode */
  129.                 GetForeColor(&sForground);
  130.                 GetBackColor(&sBackground);
  131.                 RGBForeColor(&rgbBlack);
  132.                 RGBBackColor(&rgbWhite);
  133.                 PenMode(addMax);
  134.                 PaintRect(theBox);
  135.                 RGBForeColor(&sForground);
  136.                 RGBBackColor(&sBackground);
  137.                     /* restore the pen state and leave */
  138.                 SetPenState(&penSave);
  139.                 return;
  140.             }
  141.         }
  142.     }
  143.         /* fall through to using the gray pattern */
  144.     {    Pattern ggray;
  145.         GetQDGlobalsGray(&ggray);
  146.         PenPat(&ggray);
  147.         PenMode(notPatBic);
  148.         PaintRect(theBox);
  149.         SetPenState(&penSave);
  150.     }
  151. }
  152.  
  153.  
  154. /* ShowDragHiliteBox is called to hilite the drop box area in the
  155.     main window.  Here, we draw a 3 pixel wide border around *boxBounds.  */
  156. OSErr ShowDragHiliteBox(DragReference theDragRef, Rect *boxBounds) {
  157.     RgnHandle boxRegion, insetRegion;
  158.     OSErr err;
  159.     Rect box;
  160.         /* set up locals */
  161.     boxRegion = insetRegion = NULL;
  162.         /* create the region */
  163.     if ((boxRegion = NewRgn()) == NULL) { err = memFullErr; goto bail; }
  164.     if ((insetRegion = NewRgn()) == NULL) { err = memFullErr; goto bail; }
  165.     box = *boxBounds;
  166.     InsetRect(&box, -5, -5);
  167.     RectRgn(boxRegion, &box);
  168.     InsetRect(&box, 3, 3);
  169.     RectRgn(insetRegion, &box);
  170.     DiffRgn(boxRegion, insetRegion, boxRegion);
  171.         /* hilite the region */
  172.     err = ShowDragHilite(theDragRef, boxRegion, true);
  173. bail:
  174.         /* clean up and leave */
  175.     if (boxRegion != NULL) DisposeRgn(boxRegion);
  176.     if (insetRegion != NULL) DisposeRgn(insetRegion);
  177.     return err;
  178. }
  179.  
  180.  
  181. /* FSpGetDirID returns the directory ID number for the directory
  182.     pointed to by the file specification record *spec.  */
  183. OSErr FSpGetDirID(FSSpec *spec, long *theDirID) {
  184.     CInfoPBRec cat;
  185.     OSErr err;
  186.     BlockZero(&cat, sizeof(cat));
  187.     cat.dirInfo.ioNamePtr = spec->name;
  188.     cat.dirInfo.ioVRefNum = spec->vRefNum;
  189.     cat.dirInfo.ioFDirIndex = 0;
  190.     cat.dirInfo.ioDrDirID = spec->parID;
  191.     err = PBGetCatInfoSync(&cat);
  192.     if (err != noErr) return err;
  193.     if ((cat.dirInfo.ioFlAttrib & 16) == 0) return paramErr;
  194.     *theDirID = cat.dirInfo.ioDrDirID;
  195.     return noErr;
  196. }
  197.  
  198. /* UpdateRelativeAliasFile updates the alias file located at aliasDest referring to the targetFile.
  199.     relative path information is stored in the new file.  It is appropriate for targetFile to refer
  200.     to either a file or a folder.  */
  201. OSErr UpdateRelativeAliasFile(FSSpec *theAliasFile, FSSpec *targetFile, Boolean createIfNecessary) {
  202.     CInfoPBRec cat;
  203.     FInfo fndrInfo;
  204.     AliasHandle theAlias;
  205.     Boolean wasChanged;
  206.     short rsrc;
  207.     OSErr err;
  208.          /* set up locals */
  209.     rsrc = -1;
  210.         /* set up the Finder information record */
  211.     BlockZero(&fndrInfo, sizeof(fndrInfo));
  212.     BlockZero(&cat, sizeof(cat));
  213.     cat.dirInfo.ioNamePtr = targetFile->name;
  214.     cat.dirInfo.ioVRefNum = targetFile->vRefNum;
  215.     cat.dirInfo.ioFDirIndex = 0;
  216.     cat.dirInfo.ioDrDirID = targetFile->parID;
  217.     err = PBGetCatInfoSync(&cat);
  218.     if (err != noErr) goto bail;
  219.     if ((cat.dirInfo.ioFlAttrib & 16) == 0) {    /* file alias */
  220.         switch (cat.hFileInfo.ioFlFndrInfo.fdType) {
  221.             case 'APPL': fndrInfo.fdType = kApplicationAliasType; break;
  222.             case 'APPC': fndrInfo.fdType = kApplicationCPAliasType; break;
  223.             case 'APPD': fndrInfo.fdType = kApplicationDAAliasType; break;
  224.             default: fndrInfo.fdType = cat.hFileInfo.ioFlFndrInfo.fdType; break;
  225.         }
  226.         fndrInfo.fdCreator = cat.hFileInfo.ioFlFndrInfo.fdCreator;
  227.     } else {
  228.         fndrInfo.fdType = kContainerFolderAliasType;
  229.         fndrInfo.fdCreator = 'MACS';
  230.     }
  231.     fndrInfo.fdFlags = kIsAlias;
  232.          /* set the file information or the new file */
  233.     err = FSpSetFInfo(theAliasFile, &fndrInfo);
  234.     if ((err == fnfErr) && createIfNecessary) {
  235.         FSpCreateResFile( theAliasFile, fndrInfo.fdCreator, fndrInfo.fdType, smSystemScript);
  236.         if ((err = ResError()) != noErr) goto bail;
  237.         err = FSpSetFInfo( theAliasFile, &fndrInfo);
  238.         if (err != noErr) goto bail;
  239.     } else if (err != noErr) goto bail;
  240.          /* save the resource */
  241.     rsrc = FSpOpenResFile(theAliasFile, fsRdWrPerm);
  242.     if (rsrc == -1) { err = ResError(); goto bail; }
  243.     UseResFile(rsrc);
  244.     theAlias = (AliasHandle) Get1IndResource(rAliasType, 1);
  245.     if (theAlias != NULL) {
  246.         err = UpdateAlias(theAliasFile, targetFile, theAlias, &wasChanged);
  247.         if (err != noErr) goto bail;
  248.         if (wasChanged)
  249.             ChangedResource((Handle) theAlias);
  250.     } else {
  251.         err = NewAlias(theAliasFile, targetFile, &theAlias);
  252.         if (err != noErr) goto bail;
  253.         AddResource((Handle) theAlias, rAliasType, 0, theAliasFile->name);
  254.         if ((err = ResError()) != noErr) goto bail;
  255.     }
  256.     CloseResFile(rsrc);
  257.     rsrc = -1;
  258.         /* done */
  259.     return noErr;
  260.  bail:
  261.     if (rsrc != -1) CloseResFile(rsrc);
  262.     return err;
  263.  }
  264.  
  265.  
  266. enum {
  267.     kFileSharingSignature = 'hhgg' /* Macintosh File Sharing */
  268. };
  269.  
  270. /* FileSharingAppIsRunning returns true if the file sharing
  271.     extension is running. */
  272. Boolean FileSharingAppIsRunning(void) {
  273.     ProcessSerialNumber psn;
  274.     ProcessInfoRec pinfo;
  275.  
  276.     psn.highLongOfPSN = psn.lowLongOfPSN = kNoProcess;
  277.     pinfo.processInfoLength = sizeof(ProcessInfoRec);
  278.     pinfo.processName = NULL;
  279.     pinfo.processAppSpec = NULL;
  280.     while (GetNextProcess(&psn) == noErr)
  281.         if (GetProcessInformation(&psn, &pinfo) == noErr)
  282.             if (pinfo.processSignature == kFileSharingSignature)
  283.                 return true;
  284.     return false;
  285. }
  286.  
  287.  
  288. /* FSSpecIsInDirectory returns true if the file system object
  289.     referred to by theSpec is somewhere in the directory referred
  290.     to by (vRefNum, dirID) */
  291. Boolean FSSpecIsInDirectory(FSSpec *theSpec, short vRefNum, long dirID) {
  292.     CInfoPBRec cat;
  293.     HParamBlockRec fvol, dirvol;
  294.     long currentDir;
  295.         /* check the volumes */
  296.     fvol.volumeParam.ioVRefNum = theSpec->vRefNum;
  297.     fvol.volumeParam.ioNamePtr = NULL;
  298.     fvol.volumeParam.ioVolIndex = 0;
  299.     if (PBHGetVInfoSync(&fvol)) return false;
  300.     dirvol.volumeParam.ioVRefNum = vRefNum;
  301.     dirvol.volumeParam.ioNamePtr = NULL;
  302.     dirvol.volumeParam.ioVolIndex = 0;
  303.     if (PBHGetVInfoSync(&dirvol) != noErr) return false;
  304.     if (fvol.volumeParam.ioVRefNum != dirvol.volumeParam.ioVRefNum) return false;
  305.         /* check if the directory is one of the file's parents */
  306.     currentDir = theSpec->parID;
  307.     while (true) {
  308.         if (dirID == currentDir) return true;
  309.         if (currentDir == 2) return false;
  310.             /* make sure it refers to a file in the package's directory */
  311.         BlockZero(&cat, sizeof(cat));
  312.         cat.dirInfo.ioNamePtr = NULL;
  313.         cat.dirInfo.ioVRefNum = theSpec->vRefNum;
  314.         cat.dirInfo.ioFDirIndex = -1;
  315.         cat.dirInfo.ioDrDirID = currentDir;
  316.         if (PBGetCatInfoSync(&cat) != noErr) return false;
  317.         currentDir = cat.dirInfo.ioDrParID;
  318.     }
  319. }
  320.  
  321.  
  322. /* FSSpecIsAFolder returns true if the FSSpec pointed
  323.     to by target refers to a folder. */
  324. Boolean FSSpecIsAFolder(FSSpec *target) {
  325.     CInfoPBRec cat;
  326.     OSErr err;
  327.         /* check the target's flags */
  328.     cat.dirInfo.ioNamePtr = target->name;
  329.     cat.dirInfo.ioVRefNum = target->vRefNum;
  330.     cat.dirInfo.ioFDirIndex = 0;
  331.     cat.dirInfo.ioDrDirID = target->parID;
  332.     err = PBGetCatInfoSync(&cat);
  333.     if (err != noErr) return false;
  334.     return ((cat.dirInfo.ioFlAttrib & 16) != 0);
  335. }
  336.  
  337.  
  338. /* ShowChangesInFinderWindow asks the finder redraw a directory
  339.     window by either sending a update container event to the
  340.     finder if this facility exists, or by bumping the parent directorie's
  341.     modification date */
  342. OSErr ShowChangesInFinderWindow(short vRefNum, long dirID) {
  343.     OSErr err;
  344.     long response;
  345.     CInfoPBRec cat;
  346.     Str255 name;
  347.         /* get information about the directory */
  348.     cat.hFileInfo.ioNamePtr = name;
  349.     cat.hFileInfo.ioVRefNum = vRefNum;
  350.     cat.hFileInfo.ioDirID = dirID;
  351.     cat.hFileInfo.ioFDirIndex = -1;
  352.     if ((err = PBGetCatInfoSync(&cat)) != noErr) return err;
  353.         /* determine what we can do... */
  354.     if (Gestalt(gestaltFinderAttr, &response) != noErr) response = 0;
  355.     if ((response & (1<<gestaltOSLCompliantFinder)) != 0) {
  356.         AppleEvent the_apple_event, the_reply;
  357.         AEAddressDesc target_desc;
  358.         FSSpec spec;
  359.         OSType app_creator;
  360.         long actualSize, the_error;
  361.         DescType actualType;
  362.     
  363.             /* set up a recoverable state */
  364.         AECreateDesc(typeNull, NULL, 0, &the_apple_event);
  365.         AECreateDesc(typeNull, NULL, 0, &target_desc);
  366.         AECreateDesc(typeNull, NULL, 0, &the_reply);
  367.  
  368.             /* create an update event targeted at the finder */
  369.         app_creator = 'MACS';
  370.         err = AECreateDesc(typeApplSignature, (Ptr) &app_creator,
  371.             sizeof(app_creator), &target_desc);
  372.         if (err != noErr) goto send_update_abort;
  373.         err = AECreateAppleEvent(kAEFinderSuite, kAEUpdate,
  374.             &target_desc, kAutoGenerateReturnID,
  375.             kAnyTransactionID, &the_apple_event);
  376.         if (err != noErr) goto send_update_abort;
  377.  
  378.             /* add the FSSpec parameter */
  379.         err = FSMakeFSSpec(vRefNum, cat.dirInfo.ioDrParID, name, &spec);
  380.         if (err != noErr) goto send_update_abort;
  381.         err = AEPutParamPtr(&the_apple_event, keyDirectObject, typeFSS, &spec, sizeof(FSSpec));
  382.         if (err != noErr) goto send_update_abort;
  383.  
  384.             /* send the apple event */
  385.         err = AESend(&the_apple_event, &the_reply, kAENoReply,
  386.             kAENormalPriority, kNoTimeOut, NULL, NULL);
  387.         
  388.         err = AEGetParamPtr(&the_reply, keyErrorNumber, typeLongInteger,
  389.             &actualType, &the_error, 4, &actualSize);
  390.         if (err == errAEDescNotFound)
  391.             err = noErr;
  392.         else if (err == noErr)
  393.             err = the_error;
  394.  
  395.     send_update_abort:
  396.         AEDisposeDesc(&the_apple_event);
  397.         AEDisposeDesc(&target_desc);
  398.         AEDisposeDesc(&the_reply);
  399.  
  400.     } else {    /* bump the date for the directory so the finder notices */
  401.         unsigned long secs;
  402.         GetDateTime(&secs);
  403.         cat.hFileInfo.ioFlMdDat = (secs == cat.hFileInfo.ioFlMdDat) ? (++secs) : (secs);
  404.         cat.hFileInfo.ioDirID = cat.dirInfo.ioDrParID;
  405.         err = PBSetCatInfoSync(&cat);
  406.     }
  407.     return err;
  408. }
  409.  
  410.  
  411. /* NavReplyToODOCList converts a document list returned by a Navigation Services
  412.     dialog into a document list structure that is the same format as the one
  413.     the system sends to your application's open document Apple event handler
  414.     routine.  Replies returned by Navigation Services may contain special
  415.     references to folders that may be incompatible with some document opening
  416.     strategies or routines.  By converting navigation replies into 'odoc' list
  417.     format, your application only needs to implement one document opening
  418.     routine that receives dcoument lists from both Apple events and navigation
  419.     services.  NOTE:  this is really only an issue if your application is set
  420.     up to open packages, or folders.  In these cases, you may want to correct
  421.     the Navigation Services reply structure to ensure your document opening
  422.     routine receives consistent data. */
  423. OSStatus NavReplyToODOCList(AEDescList *navReply, AEDescList *odocList) {
  424.     OSErr err;
  425.     long i, n;
  426.     FSSpec fileSpec;
  427.     AEKeyword keyWd;
  428.     DescType typeCd;
  429.     Size actSz;
  430.     AliasHandle alias;
  431.     AEDescList theDocuments;
  432.         /* set up initial state */
  433.     AECreateDesc(typeNull, NULL, 0, &theDocuments);
  434.     alias = NULL;
  435.         /* create the list */
  436.     err = AECreateList(NULL, 0, false, &theDocuments);
  437.     if (err != noErr) goto bail;
  438.         /* count the documents in the list, there must be at least one */
  439.     err = AECountItems(navReply, &n);
  440.     if (err != noErr) goto bail;
  441.         /* iterate through the documents */
  442.     for ( i = 1; i <= n; i++) {
  443.             /* get the i'th one from the source */
  444.         err = AEGetNthPtr(navReply, i, typeFSS, &keyWd, &typeCd,
  445.             (Ptr) &fileSpec, sizeof(fileSpec), (actSz = sizeof(fileSpec), &actSz));
  446.         if (err != noErr) goto bail;
  447.             /* standardize the fsspec.  */
  448.         if (fileSpec.name[0] == 0) {
  449.             CInfoPBRec cat;
  450.             Str255 name;
  451.             BlockZero(&cat, sizeof(cat));
  452.             cat.dirInfo.ioNamePtr = name;
  453.             cat.dirInfo.ioVRefNum = fileSpec.vRefNum;
  454.             cat.dirInfo.ioFDirIndex = -1;
  455.             cat.dirInfo.ioDrDirID = fileSpec.parID;
  456.             err = PBGetCatInfoSync(&cat);
  457.             if (err != noErr) goto bail;
  458.             err = FSMakeFSSpec(fileSpec.vRefNum, cat.dirInfo.ioDrParID, name, &fileSpec);
  459.             if (err != noErr) goto bail;
  460.         }
  461.             /* create an alias to it */
  462.         err = NewAliasMinimal(&fileSpec, &alias);
  463.         if (err != noErr) goto bail;
  464.             /* add the alias to the document list.  */
  465.         HLock((Handle) alias);
  466.         err = AEPutPtr(&theDocuments, i, typeAlias, *alias, GetHandleSize((Handle) alias));
  467.         if (err != noErr) goto bail;
  468.             /* done with that one...  */
  469.         DisposeHandle((Handle) alias);
  470.         alias = NULL;
  471.     }
  472.         /* save result and return */
  473.     *odocList = theDocuments;
  474.     return noErr;
  475. bail:
  476.     AEDisposeDesc(&theDocuments);
  477.     if (alias != NULL) DisposeHandle((Handle) alias);
  478.     return err;
  479. }
  480.